import type { AxiosRequestConfig, AxiosResponse } from 'axios';

export interface xmRequestInterceptors<T = AxiosResponse> {
  requestInterceptor?: (config: AxiosRequestConfig) => AxiosRequestConfig;
  requestInterceptorCatch?: (err: any) => any;
  reponseInterceptor?: (res: T) => T;
  reponseInterceptorCatch?: (err: any) => any;
}

export interface xmRequestConfig<T = AxiosResponse> extends AxiosRequestConfig {
  interceptors?: xmRequestInterceptors<T>;
  showLoading?: boolean;
}

export interface IResponse<T = any> {
  code: string;
  data: T;
}
